Skip to content

Lanai: Use TableGen to set libcall calling conventions #146080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 8, 2025

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Jun 27, 2025

No description provided.

Copy link
Contributor Author

arsenm commented Jun 27, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@llvmbot
Copy link
Member

llvmbot commented Jun 27, 2025

@llvm/pr-subscribers-tablegen

@llvm/pr-subscribers-llvm-ir

Author: Matt Arsenault (arsenm)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/146080.diff

2 Files Affected:

  • (modified) llvm/include/llvm/IR/RuntimeLibcalls.td (+12)
  • (modified) llvm/lib/Target/Lanai/LanaiISelLowering.cpp (-4)
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index 59e9481201de4..396dc45240412 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -1360,6 +1360,18 @@ def __hexagon_fast2_sqrtdf2 : RuntimeLibcallImpl<SQRT_F64>;
 def __hexagon_memcpy_likely_aligned_min32bytes_mult8bytes
     : RuntimeLibcallImpl<HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES>;
 
+//===----------------------------------------------------------------------===//
+// Lanai Runtime Libcalls
+//===----------------------------------------------------------------------===//
+
+def isLanai : RuntimeLibcallPredicate<"TT.getArch() == Triple::lanai">;
+
+// Use fast calling convention for library functions.
+def LanaiSystemLibrary
+    : SystemRuntimeLibrary<isLanai, (add DefaultRuntimeLibcallImpls)> {
+  let DefaultLibcallCallingConv = FASTCC;
+}
+
 //===----------------------------------------------------------------------===//
 // Mips16 Runtime Libcalls
 //===----------------------------------------------------------------------===//
diff --git a/llvm/lib/Target/Lanai/LanaiISelLowering.cpp b/llvm/lib/Target/Lanai/LanaiISelLowering.cpp
index ec668ebaeab0d..272c7bc1a8db6 100644
--- a/llvm/lib/Target/Lanai/LanaiISelLowering.cpp
+++ b/llvm/lib/Target/Lanai/LanaiISelLowering.cpp
@@ -150,10 +150,6 @@ LanaiTargetLowering::LanaiTargetLowering(const TargetMachine &TM,
   // statements. Re-evaluate this on new benchmarks.
   setMinimumJumpTableEntries(100);
 
-  // Use fast calling convention for library functions.
-  for (RTLIB::LibcallImpl LC : RTLIB::libcall_impls())
-    setLibcallImplCallingConv(LC, CallingConv::Fast);
-
   MaxStoresPerMemset = 16; // For @llvm.memset -> sequence of stores
   MaxStoresPerMemsetOptSize = 8;
   MaxStoresPerMemcpy = 16; // For @llvm.memcpy -> sequence of stores

Copy link
Collaborator

@RKSimon RKSimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@arsenm arsenm force-pushed the users/arsenm/lanai/use-tablegen-runtime-libcalls branch from 9cbb4db to c7f71df Compare June 28, 2025 02:35
@arsenm arsenm force-pushed the users/arsenm/tablegen/add-calling-conv-libcall-impl-sets branch 2 times, most recently from 370182a to deb69b2 Compare July 1, 2025 13:51
@arsenm arsenm force-pushed the users/arsenm/lanai/use-tablegen-runtime-libcalls branch from c7f71df to 9978b68 Compare July 1, 2025 13:51
@arsenm arsenm force-pushed the users/arsenm/tablegen/add-calling-conv-libcall-impl-sets branch from deb69b2 to d988e2c Compare July 1, 2025 14:05
@arsenm arsenm force-pushed the users/arsenm/lanai/use-tablegen-runtime-libcalls branch from 9978b68 to 2bbe9b3 Compare July 1, 2025 14:05
@arsenm arsenm force-pushed the users/arsenm/tablegen/add-calling-conv-libcall-impl-sets branch from d988e2c to ef8535c Compare July 2, 2025 00:50
@arsenm arsenm force-pushed the users/arsenm/lanai/use-tablegen-runtime-libcalls branch 2 times, most recently from 91ac52f to a492a7e Compare July 7, 2025 09:46
@arsenm arsenm force-pushed the users/arsenm/tablegen/add-calling-conv-libcall-impl-sets branch 2 times, most recently from 414f451 to 32364e6 Compare July 8, 2025 01:22
@arsenm arsenm force-pushed the users/arsenm/lanai/use-tablegen-runtime-libcalls branch 2 times, most recently from 1f131e1 to 74a0108 Compare July 8, 2025 05:17
@arsenm arsenm force-pushed the users/arsenm/tablegen/add-calling-conv-libcall-impl-sets branch from 32364e6 to b21bcf5 Compare July 8, 2025 05:17
Copy link
Contributor Author

arsenm commented Jul 8, 2025

Merge activity

  • Jul 8, 8:07 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 8, 8:13 AM UTC: Graphite rebased this pull request as part of a merge.
  • Jul 8, 8:16 AM UTC: @arsenm merged this pull request with Graphite.

@arsenm arsenm force-pushed the users/arsenm/tablegen/add-calling-conv-libcall-impl-sets branch from b21bcf5 to 2309255 Compare July 8, 2025 08:09
Base automatically changed from users/arsenm/tablegen/add-calling-conv-libcall-impl-sets to main July 8, 2025 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants